<?php
$smarty->configLoad($lang . '/report.module.php');
$language = parse_ini_file($lang . '/breadcrumb.module.php', true);
$breadcrumb = $language['detail_report'];
$value = '';
$sql = 'SELECT * FROM '.DB_CMS.'.module_preport WHERE id = :id';
$dbh = $connection->prepare($sql);
$dbh->bindValue(':id', $_GET['id']);
$dbh->execute();
$user = new user;
$_language = parse_ini_file($lang . '/report.module.php', true);

foreach($dbh->fetchAll(PDO::FETCH_ASSOC) as $row) {
	$row['username'] = $user->getName($row['userID']);
	$row['player']	= $user->getName($row['reportID']);
	if($row['status'] == '0') {
		$row['status'] = $_language['open'];
	} elseif($row['status'] == '1') {
		$row['status'] = $_language['progress'];
	} elseif($row['status'] == '2') {
		$row['status'] = $_language['closed'];
	}
	$value[] = $row;
}
$smarty->assign('value', $value);
$rep_value = '';
$sql = 'SELECT * FROM '.DB_CMS.'.module_preport_answers WHERE reportID = :id ORDER BY id DESC';
$dbh = $connection->prepare($sql);
$dbh->bindValue(':id', $_GET['id']);
$dbh->execute();
foreach($dbh->fetchAll(PDO::FETCH_ASSOC) as $row) {
	$row['username'] = $user->getName($row['adminID']);
	$rep_value[] = $row;
}
$smarty->assign('rep_value', $rep_value);
$template = 'report/detail.tpl';
?>